package com.wit.witmg.api;


import com.wit.witmg.service.ITPatentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author bob
 * @since 2024-06-12
 */
@RestController
@RequestMapping("patent")
@Api(tags = "专利信息API")
public class PatentController {
    @Resource
    private ITPatentService service;

    @ApiOperation("新建/修改")
    @PostMapping("create")
    public Object create(HttpServletRequest request,
                      @RequestParam(value = "json") String json,
                      @RequestParam(value = "pdf",required = false) MultipartFile pdf,
                      @RequestParam(value = "file",required = false) MultipartFile file) {
        return service.create(request,json,pdf,file);
    }

    @ApiOperation("查询")
    @PostMapping("get")
    public Object get(@RequestParam(value = "pro",required = false) String pro,
                      @RequestParam(value = "inv",required = false) String inv,
                      @RequestParam(value = "ag",required = false) String ag,
                      @RequestParam(value = "fld",required = false) String fld,
                      @RequestParam(value = "na",required = false) String na,
                      @RequestParam(value = "nu",required = false) String nu,
                      @RequestParam(value = "no",required = false) String no
    ) {
        return service.get(pro,inv,ag,fld,na,nu,no);
    }

    @ApiOperation("删除")
    @PostMapping("del")
    public Object del(@RequestParam("id") int id) {
        return service.del(id);
    }

}
